package edu.njust.LabSystem.Service;

import edu.njust.LabSystem.dao.ILabAppointment;
import edu.njust.LabSystem.dto.LaExpDto;
import edu.njust.LabSystem.entity.LabAppointment;
import edu.njust.LabSystem.entity.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class LabAppointmentService {

	public LabAppointment getLabAppointmentByExperiment(String experiment){
		SqlSession sqlSession=MybatisUtil.getSqlSession();
		
		ILabAppointment IlabAppointment=sqlSession.getMapper(ILabAppointment.class);
		LabAppointment labAppointment=IlabAppointment.getLabAppointmentByExperiment(experiment);
				
		sqlSession.close();
		
		return labAppointment;
	}

	public List<LabAppointment> getLabExps(String experiment){

		SqlSession sqlSession=MybatisUtil.getSqlSession();

		ILabAppointment IlabAppointment=sqlSession.getMapper(ILabAppointment.class);
		List<LabAppointment>  las=IlabAppointment.getStudentAppointmentByTeacher(experiment);

		sqlSession.close();

		return las;
	}

	public List<LaExpDto> getLabApps(){

		SqlSession sqlSession=MybatisUtil.getSqlSession();

		ILabAppointment IlabAppointment=sqlSession.getMapper(ILabAppointment.class);
		List<LaExpDto>  las=IlabAppointment.getLabApps();

		sqlSession.close();

		return las;
	}
}
